﻿using SqlSugar;

namespace Admin.Crypto
{
    /// <summary>
    /// 客户联系方式
    /// </summary>
    [SugarTable("customer_contact", "客户联系方式")]
    [SugarIndex("idx_tenentid_md5phone", new string[] { nameof(TenentId), nameof(Md5Phone) }, new OrderByType[] { OrderByType.Asc, OrderByType.Asc })]
    public class CustomerContact
    {
        /// <summary>
        /// 主键
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, Length = 36, ColumnDescription = "主键")]
        public Guid Id { get; set; }

        /// <summary>
        /// 全加密数据
        /// </summary>
        [SugarColumn(Length = 512, ColumnDescription = "全加密数据", IsNullable = false)]
        public string EncryptionData { get; set; } = string.Empty;

        /// <summary>
        /// 半隐式数据
        /// </summary>
        [SugarColumn(Length = 64, ColumnDescription = "半隐式数据", IsNullable = false)]
        public string SemiData { get; set; } = string.Empty;

        /// <summary>
        /// md5 手机号码，方便知道手机号码的时候直接查找数据
        /// </summary>
        [SugarColumn(Length = 32, ColumnDescription = "md5 手机号码", IsNullable = false)]
        public string Md5Phone { get; set; } = string.Empty;

        /// <summary>
        /// 租户ID
        /// </summary>
        [SugarColumn(ColumnDescription = "租户ID")]
        public long TenentId { get; set; } = 0;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnDescription = "创建时间", InsertServerTime = true)]
        public DateTime CreationTime { get; set; }

        /// <summary>
        /// 创建者Id
        /// </summary>
        [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
        public long? CreateUserId { get; set; }
    }
}
